import {defineConfig} from 'vite'
import vue from '@vitejs/plugin-vue'

// https://vite.dev/config/
export default defineConfig({
    plugins: [vue()],
    server: {
        proxy: {
            // 将/api前缀的请求代理到Spring Boot后端
            '/api': {
                target: 'http://localhost:8080', // 后端服务地址
                changeOrigin: true,
                rewrite: (path) => path.replace(/^\/api/, 'api'),
            },
        },
    },
    build: {
        outDir: '../../resources/static',
        emptyOutDir: true,
        assetsDir: '',
    }
})
